package com.fangngng.pushall.mapper;

import com.fangngng.pushall.dto.TagQuery;
import com.fangngng.pushall.dto.TopicQuery;
import com.fangngng.pushall.entity.Tag;
import com.fangngng.pushall.entity.Topic;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.common.BaseMapper;

import java.util.List;

@Repository
@Mapper
public interface TagMapper extends BaseMapper<Tag> {

    /**
     * 根据主题查询标签
     * @param topicId
     * @return
     */
    List<Tag> findTagByTopicId(@Param("topicId") Integer topicId);

    /**
     * 最热10个tag
     * @return
     */
    List<Tag> getHottest10Tag();

    /**
     * 最新10个tag
     * @return
     */
    List<Tag> getNewest10Tag();

    /**
     * 分页查询
     * @param topicQuery
     * @return
     */
    List<Tag> findByCondition(@Param("query") TagQuery topicQuery);
}